home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15233 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: curses.h <-- getch()  ?
  5. Date: 17 Apr 1996 13:23:27 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4l3jvvINNieo@keats.ugrad.cs.ubc.ca>
  8. References: <317543A1.75A8@sun.uniag.sk>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <317543A1.75A8@sun.uniag.sk>,
  12. Billik Stefan - 2.PEF <billik@sun.uniag.sk> wrote:
  13.  >My problem is that this program don't like our cc && gcc compilers:
  14.  >
  15.  >-------------------------
  16.  >/* It should do this thing:
  17.  >   after eighth character it should print it on screen
  18.  >   - means without <ENTER>
  19.  >*/
  20.  >
  21.  >#include <stdio.h>
  22.  >#include <string.h>
  23.  >#include <signal.h>
  24.  >#include <curses.h>
  25.  > 
  26.  >main()
  27.  >{
  28.  > 
  29.  > char ch[9];
  30.  > int i;
  31.  > 
  32.  > printf("\n Press 8 characters ... \n");
  33.  > 
  34.  > for ( i=0 ; i<=8 ; i++ )
  35.  > ch[i]=getch();
  36.  > printf("\n %s \n", ch[0]);
  37.  > 
  38.  >}
  39.  
  40. The eight character thing ain't gonna happen, because you did not intialize
  41. curses or tell it to go to raw() or cbreak() mode. As far as I remember, a
  42. common sequence is:
  43.  
  44.     initscr();
  45.     noecho();
  46.     nonl();
  47.     cbreak();
  48.  
  49.     /* your key input routine    */
  50.  
  51.     endwin();
  52.  
  53.  
  54.  >-------------------------
  55.  >During compilation:
  56.  >
  57.  > 18:02 /usr1/users/student/billik/C/$ cc c/getstring.c
  58.  >Undefined                       first referenced
  59.  > symbol                             in file
  60.  >wgetch                              getstring.o
  61.  >stdscr                              getstring.o
  62.  >ld: fatal: Symbol referencing errors. No output written to a.out
  63.  > 18:02 /usr1/users/student/billik/C/$ 
  64.  
  65.  >also with gcc.
  66.  >What do you think ?
  67.  
  68. I think that maybe you need to link in a curses library with -lcurses?
  69.  
  70.  >PS1: SunOS 5.4                                                       
  71.  
  72. You misspelled "Solaris".
  73. -- 
  74. I'm not really a jerk, but I play one on Usenet.
  75.